]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Status Menu: use Gnome Session DBus for shutdown and logout
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 12 Mar 2011 20:34:01 +0000 (21:34 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 12 Mar 2011 20:37:39 +0000 (21:37 +0100)
Around 2.91.90, gnome-session-save was renamed to gnome-session-quit.
This commit restores compatibility with the older gnome-session, for
those testing under GNOME 2.32 or below, by calling the DBus methods
directly.

https://bugzilla.gnome.org/show_bug.cgi?id=644591

js/misc/gnomeSession.js
js/ui/statusMenu.js

index ce4e7e9d3e80802ea6496076129601cfa42461f6..1a52a6f4b6602fb06efa7d6c26cb88789c5b8f74 100644 (file)
@@ -102,3 +102,24 @@ Inhibitor.prototype = {
 };
 DBus.proxifyPrototype(Inhibitor.prototype, InhibitorIface);
 Signals.addSignalMethods(Inhibitor.prototype);
+
+
+// Not the full interface, only the methods we use
+const SessionManagerIface = {
+    name: 'org.gnome.SessionManager',
+    methods: [
+        { name: 'Logout', inSignature: 'u', outSignature: '' },
+        { name: 'Shutdown', inSignature: '', outSignature: '' }
+    ]
+};
+
+function SessionManager() {
+    this._init();
+}
+
+SessionManager.prototype = {
+    _init: function() {
+        DBus.session.proxifyObject(this, 'org.gnome.SessionManager', '/org/gnome/SessionManager');
+    }
+};
+DBus.proxifyPrototype(SessionManager.prototype, SessionManagerIface);
\ No newline at end of file
index 9c251b83c0672ba324fe0113231b3ed6e39ca57d..2a04506dbdd44a3ef24b3b1aa1333dbcce25eb1e 100644 (file)
@@ -50,6 +50,7 @@ StatusMenuButton.prototype = {
         this._user = this._gdm.get_user(GLib.get_user_name());
         this._presence = new GnomeSession.Presence();
         this._presenceItems = {};
+        this._session = new GnomeSession.SessionManager();
 
         this._account_mgr = Tp.AccountManager.dup()
 
@@ -210,7 +211,7 @@ StatusMenuButton.prototype = {
 
     _onQuitSessionActivate: function() {
         Main.overview.hide();
-        Util.spawn(['gnome-session-quit', '--logout']);
+        this._session.LogoutRemote(0);
     },
 
     _onSuspendOrPowerOffActivate: function() {
@@ -222,7 +223,7 @@ StatusMenuButton.prototype = {
                 this._upClient.suspend_sync(null);
             }));
         } else {
-            Util.spawn(['gnome-session-quit', '--power-off']);
+            this._session.ShutdownRemote();
         }
     },